home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.sprintlink.net!news1!ind-005-236-220
- From: dlmiller@iquest.net (Doug Miller)
- Subject: Re: HELP. How to convert '0x12' into FF char?
- X-Nntp-Posting-Host: ind-005-236-220.iquest.net
- Message-ID: <DoGtEt.Hwx@iquest.net>
- Sender: news@iquest.net (News Admin)
- Organization: IQuest Network Services
- X-Newsreader: News Xpress Version 1.0 Beta #2.1
- References: <4iissm$s76@nntp.ucs.ubc.ca>
- Date: Mon, 18 Mar 1996 13:30:16 GMT
-
- gordonw@unixg.ubc.ca (Gordon Wong) wrote:
- +Xref: news1 comp.lang.c:71002
- +Path: news1!news.sprintlink.net!howland.reston.ans.net!swrinde!sgigate.sgi.com!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!van-bc!unixg.ubc.ca!news
- +From: gordonw@unixg.ubc.ca (Gordon Wong)
- +Newsgroups: comp.lang.c
- +Subject: HELP. How to convert '0x12' into FF char?
- +Date: Mon, 18 Mar 1996 05:40:13 GMT
- +Organization: The University of British Columbia
- +Lines: 17
- +Message-ID: <4iissm$s76@nntp.ucs.ubc.ca>
- +NNTP-Posting-Host: port38.annex2.net.ubc.ca
- +X-Newsreader: Forte Free Agent 1.0.81
- +
- +Let's say we have d='1' and e='2' and the following code segment:
- +:
- +:
- +f='0x';
- +strcpy(f,d);
- +strcpy(f,e);
- +
- +f now contains the string '0x12' right?
- +How would I write that out as a single ASCII FF character?
- +(d,e,f are char)
- +
- +Please reply here and email also if poss. Thanks for any ideas.
- +
- +Gordon Wong, gordonw@unixg.ubc.ca
- +
- +Gordon Wong, gordonw@unixg.ubc.ca
- +
- int hex;
- sscanf (f, "%x", &hex);
- printf ("%c", hex);
-
- ....but please be aware that 0x12 is not an ASCII FF (form-feed) character. 0x12 is the ASCII
- DC2 character; the form-feed is *decimal* 12 or 0x0C.
-